﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Eis51.CampanyCMS.Model.Bus;
using Eis51.CampanyCMS.Business.Bus;
using System.Collections;

namespace Eis51.Web.dataPage
{
    public partial class PurchaseDT : System.Web.UI.Page
    {
        private int Pid;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            if (!Check())
            {
                return;
            }
            LoadData();
        }

        private bool Check()
        {
            if (string.IsNullOrEmpty(Request.QueryString["pid"]))
            {
                return false;
            }
            return true;
        }


        private void LoadData()
        {
            try
            {
                Pid = int.Parse(Request.QueryString["pid"]);
            }
            catch (Exception ex)
            {
                return;
            }
            LoadProduct();
        }

        private void LoadProduct()
        {
            string scondition = " title like '%{0}%'  and Licd={1}  ";

            //string sTreeList = "";

            scondition = "ProductID = " + Pid;

            IList list = PurchaseBLL.GetInstance().Search(scondition);
            if (null != list && list.Count > 0)
            {
                Purchase product = (Purchase)list[0];
                if (null != product)
                {
                    divContent.InnerHtml = product.Descr;
                }
            }
            
        }
    }
}
